const filters={
  //格式化日期为“yyyy-MM-dd hh:mm:ss”
  formatDate:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    var seconds = time.getSeconds();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes) + ':' + rightTwo(seconds);
  },

  //格式化日期为“yyyy-MM-dd”
  formatDates:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date);
  },
  //格式化日期为“yyyy-MM”
  formatDatess:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    return year + '-' + rightTwo(month);
  },
//格式化日期为“yyyy-MM-dd hh:mm”
  formatDateo:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yy-MM-dd hh:mm”
  formatDateo1:function(value) {
    if (value==null) return "--"
    var time = new Date(+value);
    var rightTwo = (v) => {
      v = '0' + v
      return v.substring(v.length - 2, v.length)
    }
    if (time == null) return ;
    var year = time.getFullYear();
    var month = time.getMonth() + 1;
    var date = time.getDate();
    var hours = time.getHours();
    var minutes = time.getMinutes();
    return year + '-' + rightTwo(month) + '-' + rightTwo(date) + ' ' + rightTwo(hours) + ':' + rightTwo(minutes);
  },
  //格式化日期为“yyyyMM”
  formatDatesss:function(value) {
  if (value==null) return "--"
  var time = new Date(+value);
  var rightTwo = (v) => {
    v = '0' + v
    return v.substring(v.length - 2, v.length)
  }
  if (time == null) return ;
  var year = time.getFullYear();
  var month = time.getMonth() + 1;
  return year + rightTwo(month);
},




 //**********日志-登陆日志类型过滤***********
  loginJournal_Type:function(value) {
    switch (value){
      case "1": return "登录"
      case "2": return "登出"
      case "3": return "操作"
      default: return "--"
    }
  },
  loginJournal_Result:function(value) {
    switch (value){
      case "1": return "成功"
      case "0": return "操作失败"     
      default: return "--"
    }
  },

//**********企业列表 会员类型***********
    entMember:function(value){

      if(value == undefined){
        return 
      }
      let arr=value.split(',')
      let result='';
      arr.forEach((item)=>{
        if(item == '1'){
          result+='交易类会员，'
        }
        else if(item == '2'){
          result+='服务类会员，'
        }
        else if(item == '3'){
          result+='经济类会员，'
        }
        else if(item == '4'){
          result+='承销类会员，'
        }
        else if(item == '5'){
          result+='综合类会员，'
        }
        else{
          result += '--,'
        }
      })

      return result.slice(0,-1)
    },

//**********公共 ***********
/*判断资金是否为空字符串*/
judgeAccount:function(value) {
      if(value == ''  || value == 0 || value ==null){
        return  '--'
      }
      return value+'（万元）'
},
//**********用户列表 职务***********
    userPosition:function(value) {
      switch (value){
        case '1': return "负责人" 
        case '2': return "普通员工"
        default: return "--"
      }
    },
    userState:function(value) { 
      switch (value){
        case '0': return "停用" 
        case '1': return "正常"
        default: return "--"
      }
    },
    userGender:function(value) { 
      switch (value){
        case '1': return "男" 
        case '2': return "女"
        default: return "--"
      }
    },

//**********业务 项目 新增编辑 添加企业项目角色***********
pro_comRole:function(value){
    switch (value){
        case '1': return "发行方" 
        case '2': return "担保方"
        case '3': return "承销方"
        case '4': return "律所"
        case '5': return "受托管理方"
        case '6': return "投资顾问"
        default: return "--"
      }
},
pro_comCharge:function(value){
    switch (value){
        case '1': return "募集款扣款" 
        case '2': return "转账扣款"
        case '3': return "不收取"
        default: return "--"
      }
},
//项目列表  项目类型
project_type:function(value){
    switch (value){
        case '1': return "收益权类" 
        case '2': return "定向融资类"
        case '3': return "资产登记交易类"
        case '4': return "资产转让增值"
        case '5': return "其他类"
        default: return "--"
      }
},
//项目融资主体性质
project_rongzi:function(value){
    switch (value){  
        case '1': return "政信" 
        case '2': return "地产"
        case '3': return "国企"
        case '4': return "其他行业龙头"
        default: return "--"
      }
},

/*项目审批状态*/
project_status:function(value){
    switch (value){
        case 1: return "未立项" 
        case 2: return "立项审批中"
        case 3: return "立项审批未通过"
        case 4: return "立项通过，待过会"
        case 5: return "过会审批中"
        case 6: return "过会审批未通过"
        case 7: return "已过会"
        case 8: return "立项申请修改中"
        case 9: return "过会申请修改中"
        default: return "--" 
      }
},
//募集方式
pro_route:function(value){
    switch (value){
        case '1': return "场内" 
        case '2': return "场外"
        default: return "--" 
      }
},
 // 交易所拟收费方
pro_chargesMethod:function(value){
    switch (value){
        case '1': return "年化收取" 
        case '2': return "单笔收取"
        default: return "" 
      }
},

//项目-部门负责人-合规负责人-执行总经理
project_exaAll_type:function(value){ 
    switch (value){
        case 0: return "提审信息修改中" 
        case 1: return "等待部门负责人审批" 
        case 2: return "部门负责人审批中"
        case 3: return "部门负责人通过,等待合规负责人审批"
        case 4: return "合规负责人审批中"
        case 5: return "合规负责人通过,等待执行总经理审批"
        case 6: return "执行总经理审批中"
        case 7: return "执行总经理审批通过"
        case 8: return "审批未通过"
        default: return "--"
      }
},

/*项目-产品审批类型*/
Exa_type:function(value){
    switch (value){ 
        case '1': return "项目立项" 
        case '2': return "项目过会"
        case '3': return "产品协议用印"
        case '4': return "产品发行"
        default: return "--"
      }
},

//项目详情  收费方式
project_fare_type:function(value){
    switch (value){
        case '1': return "前置" 
        case '2': return "按季"
        case '3': return "按月"
        case '4': return ""
        default: return "--"
      }
},
//项目详情  产品期限单位
project_qixianUnit:function(value){
    switch (value){
        case '1': return "天" 
        case '2': return "周"
        case '3': return "个月"
        case '4': return "年"
        default: return "--"
      }
},

//**********业务 产品 ***********
//列表 产品种类
pro_type:function(value){
    switch (value){
        case '1': return "收益权类" 
        case '2': return "定向融资类"
        case '3': return "资产登记交易类"
        case '4': return "资产转让增值"
        case '5': return "其他类"
        default: return "--"
      }
},
//列表 产品状态
product_status:function(value){
    switch (value){   
        case 1: return "待用印" 
        case 2: return "用印审批中"
        case 3: return "用印审批未通过"
        case 4: return "用印通过，待发行"
        case 5: return "发行审批中"
        case 6: return "发行审批未通过"
        case 7: return "已发行"
        case 8: return "用印申请修改中"
        case 9: return "发行申请修改中"
        default: return "--"
      }
},
product_duifu:function(value){ 
    switch (value){
        case '1': return "年" 
        case '2': return "半年"
        case '3': return "季度"
        case '4': return "自然季度"
        case '5': return "自然半年付息"
        case '6': return "一次性到期本息"
        default: return "--"
      }
},
//产品发行  数字加，转化
pro_exa_produce:function(value){
      if(value<1000){
        return value
      }
     let result = [ ], counter = 0;
     value = (value || 0).toString().split('');
     for (let i = value.length - 1; i >= 0; i--) {
         counter++;
         result.unshift(value[i]);
         if (!(counter % 3) && i != 0) { result.unshift(','); }
     }
     return result.join('');

},
}

export default filters;
